import QtQuick 2.6
import QtQuick.Layouts 1.1

import "../../../Base/UiBase"
import "../../../Base/Config"

Rectangle {
    id: root
    property string teacherId

    color: Color.background

    ColumnLayout {
        anchors.fill: parent
        spacing: 0

        // nav bar
        Rectangle {
            Layout.fillWidth: true
            height: 96 * Size.ratio
            color: Color.foreground

            MouseArea {
                width: height
                height: parent.height

                onClicked: root.visible = false
                Rectangle {
                    color: Color.pressed
                    visible: parent.pressed
                }
                SvgzImage {
                    anchors.centerIn: parent
                    sourceSize.width: 80 * Size.ratio
                    sourceSize.height: 96 * Size.ratio
                    source: "../../../../resources/comment/fanhiu01.svg"
                }
            }
            Text {
                anchors.centerIn: parent
                text: "热门老师"
                font.pixelSize: Size.largeFont
            }

            BottomDivider {
            }
        }

        // filter bar
        Rectangle {
            Layout.fillWidth: true
            height: 50 * Size.ratio
            ImageButton {
                property bool activated: false

                sourceSize.width: 137 * Size.ratio
                sourceSize.height: parent.height
                width: sourceSize.width
                height: sourceSize.height
                source: activated ? "../../../../resources/tcommunity/filterBar/shaixuan02.svg" : "../../../../resources/tcommunity/filterBar/shaixuan01.svg"

                onClicked: activated = !activated
            }
        }

        Item {
            Layout.fillWidth: true
            Layout.preferredHeight: Size.elementInterval
        }

        ListView {
            id: teachersContainer
            Layout.fillWidth: true
            Layout.fillHeight: true
            z: -1
            model: teachersModel
            delegate: Teacher {
                Menu{}
            }
        }
    }

    MouseArea {
        anchors.fill: parent
        z: -1
    }

    // teachers
    ListModel {
        id: teachersModel
        ListElement {
            name: "0403"
            head: "../../../../resources/tests/Beautiful Notebook.PNG"
            unit: "特圈"
            level: "学生"
            school: "广西师范大学"
            major: "钢琴专业"
            detail: "11111111111111111111111111111111111111111111111111111111111aaaaaaaaaaaaaaaaaaa啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊"
            evaluated: 1234
            acceptedEvaluation: 1222
        }
        ListElement {
            name: "Happy0403"
            head: "../../../../resources/tests/Beautiful Notebook.PNG"
            unit: "特圈"
            level: "学生"
            school: "广西师范大学"
            major: "钢琴专业"
            detail: "11111111111111111111111111111111111111111111111111111111111aaaaaaaaaaaaaaaaaaa"
            evaluated: 300
            acceptedEvaluation: 276
        }
        ListElement {
            name: "HappyZh"
            head: "../../../../resources/tests/Beautiful Notebook.PNG"
            unit: "特圈"
            level: "学生"
            school: "广西师范大学"
            major: "钢琴专业"
            detail: "11111111111111111111111111111111111111111111111111111111111aaaaaaaaaaaaaaaaaaa"
            evaluated: 99
            acceptedEvaluation: 88
        }
    }
}
